package com.linxz.framework.databases;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * @author Linxz
 * 创建日期：2019年05月16日 22:16
 * version：v4.0.1
 * 描述：
 */
public abstract class AbsDBHelper extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "yzyl.db";
    private static final int DATABASE_VERSION = 1;

    public AbsDBHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    public AbsDBHelper(Context context,String DATABASE_NAME) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    public AbsDBHelper(Context context,String DATABASE_NAME,int DATABASE_VERSION) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //基础题库表
        createTables(db);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        updateDataBase(db,oldVersion,newVersion);
    }

    public abstract void createTables(SQLiteDatabase db);

    public abstract void updateDataBase(SQLiteDatabase db, int oldVersion, int newVersion);
}
